<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Create an event</title>

</h:head>
<h:body>

	<h:form>
		<p:growl id="msgs" showDetail="true" />
		<!-- form in which the user can insert the details of a new event that he wants to create -->
		<p:panel class="panel" header="Create a new Event">
			<h:panelGrid columns="3" cellpadding="5" id="evGrid">
				<p:outputLabel for="title">Title:</p:outputLabel>
				<p:inputText id="title"
					value="#{indoorEventCreationBean.current.title}">
					<p:ajax update="titlemsg" />
				</p:inputText>
				<p:message id="titlemsg" for="title" />

				<p:outputLabel for="description">Description:</p:outputLabel>
				<p:inputText id="description"
					value="#{indoorEventCreationBean.current.description}">
					<p:ajax update="descriptionmsg" />
				</p:inputText>
				<p:message id="descriptionmsg" for="description" />

				<p:outputLabel for="location">Location:</p:outputLabel>
				<p:inputText id="location"
					value="#{indoorEventCreationBean.current.location}">
					<p:ajax update="locationmsg" />
				</p:inputText>
				<p:message id="locationmsg" for="location" />

				<p:outputLabel value="start Date:" />
				<p:calendar value="#{indoorEventCreationBean.current.startDate}"
					mode="popup" pattern="dd/MM/yyyy HH:mm">
					<p:ajax update="startDatemsg" />
				</p:calendar>
				<p:message id="startDatemsg" for="startDatemsg" />

				<p:outputLabel value="end Date" />
				<p:calendar value="#{indoorEventCreationBean.current.endDate}"
					mode="popup" pattern="dd/MM/yyyy HH:mm">
					<p:ajax update="endDatemsg" />
				</p:calendar>
				<p:message id="endDatemsg" for="endDatemsg" />


				<p:outputLabel for="visible" value="visiblity:" />
				<p:selectOneMenu id="visible"
					value="#{indoorEventCreationBean.current.visibility}"
					style="width:125px">
					<f:selectItem itemLabel="Private" itemValue="private" />
					<f:selectItem itemLabel="Public" itemValue="public" />
				</p:selectOneMenu>
				<p:message id="visiblemsg" for="visible" />


			</h:panelGrid>
			<p:dataTable id="checkboxDT" var="user" value="#{checkboxView.users}"
				selection="#{checkboxView.selectedUsers}" rowKey="#{user.username}"
				style="margin-bottom:0" scrollable="true" width="400">
				<f:facet name="header">
            			Invited Users:
        			</f:facet>
				<p:column selectionMode="multiple"
					style="width:16px;text-align:center" />
				<p:column headerText="username">
					<h:outputText value="#{user.username}" />
				</p:column>
				<p:column headerText="email">
					<h:outputText value="#{user.email}" />
				</p:column>
			</p:dataTable>
			<p:commandButton value="Create" update="msgs"
				action="#{indoorEventCreationBean.createEvent()}" />

			<p:commandButton value="Main Page" icon="ui-icon-home"
				action="mainPage" immediate="true" />

		</p:panel>
	</h:form>
</h:body>
</html>